home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 12⁄22⁄89 / 0260-Re Memory Clarificat-Dec89 < prev    next >
Encoding:
Text File  |  1989-12-22  |  2.7 KB  |  62 lines  |  [TEXT/GEOL]

  1. Item    2254443                         22-Dec-89        11:53
  2.  
  3. From:   ROSENSTEIN1                     Rosenstein, Larry
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.         MADA2                           MacApp Dev Assoc, Curtis Faith
  7.  
  8. Sub:    RE>Memory Clarifications
  9.  
  10. Attn: MacApp Tech
  11. Attn: MacApp Dev Assoc, Curtis Faith
  12. SentBy: Larry Rosenstein
  13. Date   12/22/89
  14. Subject    RE>Memory Clarifications
  15. From   Larry Rosenstein
  16. To MacApp Dev Assoc, Curtis Faith
  17.    MacApp Tech
  18.  
  19.          Reply to:   RE>Memory Clarifications
  20. Curtis,
  21.  
  22. I think it is more correct to say permanent memory is permanent because that
  23. memory is controlled by the user.  It is up to the user to free that memory by
  24. deleting something from the document.  Temporary memory is memory under
  25. control of the application, since it can purge code segments, etc.
  26.  
  27. The handles you create are not tagged in anyway to distinguish them.
  28. Permanent and temporary memory is distinguished by the setting of the
  29. PermAllocation flag at the time you call the Memory Manager.  So it is
  30. necessary to call PermAllocation(TRUE) before calling SetHandleSize if the
  31. handle you are resizing is part of the document's data.  That's because if you
  32. are making the handle larger, then you need some additional "permanent"
  33. memory, and the only way for MacApp to know this is by the setting of the
  34. PermAllocation flag.  The same is true of HandToHand.
  35.  
  36. The setting of the PermAllocation flag controls what MacApp does if it runs
  37. out of memory.  If PermAllocation is FALSE, then MacApp will deallocate its
  38. temporary reserve to try to ensure that the request succeeds.  (That's because
  39. a temporary allocation must succeed.)  If the flag is TRUE then MacApp won't
  40. deallocate this reserve and the allocation might fail.
  41.  
  42. The only reason MacApp keeps a list of temporary handles is to better optimize
  43. the memory usage.  You tell MacApp the maximum amount of temporary memory your
  44. program uses, and MacApp ensure that this memory is always available.  Any
  45. temporary handles already allocated counts towards this total.
  46.  
  47. If you allocate a 10K temporary handle that isn't on MacApp's list, then
  48. MacApp won't know that this is temporary and that 10K won't count towards
  49. satisfying the application's temporary memory requirements.  The result is
  50. that MacApp may make the temporary reserve 10K higher than it really needs to
  51. be.  In most cases, this won't be a problem.
  52.  
  53. To summarize.  I think you need to set the PermAllocation flag to TRUE if you
  54. do any call that allocates permanent memory that belongs to the document.  I
  55. don't think you need to worry about adding to MacApp's temporary memory list,
  56. unless you are allocating lots (~50-100K) of temporary memory and keeping this
  57. memory around for a long time.
  58.  
  59. Larry Rosenstein
  60.  
  61.  
  62.